package org.example.test;

import com.google.protobuf.util.JsonFormat;
import com.zhuanzhuan.aplum.business.client.srv.editor.EditorParams;
import com.zhuanzhuan.aplum.business.client.srv.editor.EditorTypes;

import java.io.IOException;

/**
 * @author liyishan
 * @date 2025/3/2
 * @description
 */
public class GrpcExample {
    public static void main(String[] args) throws IOException {
        EditorParams.GetSkuByImageResponse getSkuByImageResponse = EditorParams.GetSkuByImageResponse
            .newBuilder()
            .setCode(200)
            .setMsg("成功")
            .addData(0,EditorTypes.GetSkuByImage.newBuilder()
                .setSkuId(1L)
                .setImgUrl("https://img.alicdn.com/imgextra/i1/O1CN01KXJqYq1NyJXQZQJYQ_!!6000000000000-0-tps-200-200.jpg")
                .build())
            .addData(1,EditorTypes.GetSkuByImage.newBuilder()
                .setSkuId(2L)
                .setImgUrl("https://img.alicdn.com/imgextra/i1/O1CN01KXJqYq1NyJXQZQJYQ_!!6000000000000-0-tps-200-200.jpg")
                .build())
            .build();
        JsonFormat.Printer printer = JsonFormat.printer();
        String json = printer.print(getSkuByImageResponse);
        System.out.println(json);
    }
}
